package com.ruoyi.web.controller.school;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.school.domain.PacActualOutputParticipation;
import com.ruoyi.school.domain.Student;
import com.ruoyi.school.domain.vo.ActualOutputParticipationListVo;
import com.ruoyi.school.service.PacActualOutputParticipationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/*
 * @Author Lin
 * @Description 实战成果参与
 * @Date 2025/7/10
 */
@Api("实战成果参与相关接口")
@RestController
@RequestMapping("/school/actualOutPutParticipation")
public class PacActualOutputParticipationController extends BaseController {
    @Resource
    private PacActualOutputParticipationService pacActualOutputParticipationService;

    @ApiOperation("参与实战成果列表")
    @Log(title = "参与实战成果", businessType = BusinessType.INSERT)
    @PostMapping("/join")
    public AjaxResult join(@RequestBody PacActualOutputParticipation pacAcademicOutput) {
        boolean add = pacActualOutputParticipationService.join(pacAcademicOutput);
        return success(add);
    }

    @Log(title = "获取参与人员", businessType = BusinessType.OTHER)
    @GetMapping("/list")
    public AjaxResult getParticipants(Long pacActualOutputId) {
        List<ActualOutputParticipationListVo> participants = pacActualOutputParticipationService.getParticipants(pacActualOutputId);
        return success(participants);
    }

    @Log(title = "删除参与人员", businessType = BusinessType.DELETE)
    @DeleteMapping("/delete")
    public AjaxResult delete(Long id) {
        pacActualOutputParticipationService.delete(id);
        return success();
    }


    @Log(title = "获取详情", businessType = BusinessType.DELETE)
    @GetMapping("/details")
    public AjaxResult details(Long id) {
        PacActualOutputParticipation details = pacActualOutputParticipationService.details(id);
        return success(details);
    }

}
